﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admin_announce.aspx.cs" Inherits="Master_Admin_announce" %>

<%@ Register Assembly="DotNetTextBox" Namespace="DotNetTextBox" TagPrefix="DNTB" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="Css/Css.css" rel="stylesheet" type="text/css" />
    <script src="../script/Validate.js" type="text/javascript"></script>
    <script type="text/javascript">
        function validate() {         
            if (valObj.RequiredControlValueByControlId("txtAnnounceTitle", "value")) {
                alert('公告标题不能为空');
                return false;
            }
            if (valObj.RequiredControlValueByControlId("AnnouceWebEdit", "value")) {
                alert('公告内容不能为空');
                return false;
            }
        }
    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border" align="center">
        <tr>
            <td colspan="2" align="center" class="title">
                <strong>网 站 公 告 管 理</strong>
            </td>
        </tr>
        <tr class="tdbg">
            <td width="70" height="30">
                <strong>管理导航：</strong>
            </td>
            <td height="30">
                <a href="admin_announce.aspx?Action=Add">添加公告</a>&nbsp;|&nbsp;<a href="admin_announce.aspx?Action=List">所有公告</a>
            </td>
        </tr>
    </table>
    
    <asp:Panel ID="palAddAnnounce" runat="server" Visible="true">
        <table cellpadding="0" cellspacing="1" border="0" width="100%" class="border" align=center>
            <tr>
                <td colspan="2" align="center" class="title">
                    <strong>
                        添加公告</strong>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25" valign="middle">
                    <strong>公告标题：</strong>
                </td>
                <td height="25">
                    <asp:TextBox ID="txtAnnounceTitle" runat="server" Width="192px"></asp:TextBox><font color="#FF6600">*</font><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtAnnounceTitle" Display="Dynamic" ErrorMessage="公告标题不能为空"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>公告内容：</strong>
                </td>
                <td height="25">
                    <font color="#FF6600">
                        <DNTB:WebEditor ID=AnnouceWebEdit runat=server UploadConfig="my.config" MenuConfig="my.config" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="AnnouceWebEdit" Display="Dynamic" ErrorMessage="公告内容不能为空"></asp:RequiredFieldValidator></font>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>设置热点：</strong>
                </td>
                <td height="25" valign="middle">
                    <asp:RadioButtonList ID="isHot" runat="server" RepeatColumns="3">
                        <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                        <asp:ListItem Value="1">是</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class="tdbg">
                <td width="300" height="25">
                    <strong>设置最新：</strong>
                </td>
                <td height="25" valign="middle">
                    <asp:RadioButtonList ID="isNew" runat="server" RepeatColumns="3">
                        <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                        <asp:ListItem Value="1">是</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class="tdbg">
                <td height="40" colspan="2" align="center">
                    <input name="Action" type="hidden" id="Action" value="SaveModify">
                    <asp:HiddenField ID="CurrID" runat="server" />
                    <asp:Button OnClientClick="return validate();" ID="btnSubmit" runat="server" Style="cursor: hand; background-color: #cccccc;" Text="  确     定  " OnClick="btnSubmit_Click" />&nbsp;<asp:Button ID="btnUpdate" runat="server" OnClientClick="validate()" Style="cursor: hand; background-color: #cccccc;" Text="  修    改  " OnClick="btnUpdate_Click" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <asp:Panel ID="palListAnnounce" runat="server">
        <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
            <tr class="title">
                <td height="30" align="center">
                    添加时间
                </td>
                <td height="30" align="center">
                    公告标题
                </td>
                <td height="30" align="center">
                    公告内容
                </td>
                <td height="30" align="center">
                    是否热点
                </td>
                <td height="30" align="center">
                    是否最新
                </td>
                <td height="30" align="center">
                    操作
                </td>
            </tr>
            <asp:Repeater ID="rptAnnouceList" runat="server" 
                onitemcommand="rptAnnouceList_ItemCommand">
                <ItemTemplate>
                    <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#cccccc'" style="padding: 0px 2px;">
                        <td height="30" align="center">
                            <%#Eval("addTime")%>
                        </td>
                        <td height="30" align="center">
                            <%#AspNetCs.Common.StringHelper.stringformat(Eval("Title").ToString(), 20)%>
                        </td>
                        <td align="center">
                            <%#AspNetCs.Common.StringHelper.stringformat(Eval("Content").ToString(), 30)%>
                        </td>
                        <td align="center">
                            <%#Eval("hot").ToString()=="1"?"是":"否"%>
                        </td>
                        <td align="center">
                            <%#Eval("isNew").ToString() == "1" ? "是" : "否"%>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btn_modify" runat="server" CommandArgument='<%#Eval("id") %>' CommandName="Modify">修改</asp:LinkButton>
                            <asp:LinkButton ID="btn_del" runat="server" CommandArgument='<%#Eval("id") %>' CommandName="delete" OnClientClick="javascript:return confirm('是否真的删除,此操作将不可恢复!')">删除</asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <asp:Panel ID="pl_nothing" runat="server" Visible="false">
                        <tr>
                            <td colspan="8">
                                暂任何公告内容
                            </td>
                        </tr>
                    </asp:Panel>
                </FooterTemplate>
            </asp:Repeater>
            <tr class="tdbg">
                <td colspan="6" height="25" align="right">
                    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_PageChanged" CurrentPageButtonPosition="Beginning" CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页，每页%PageSize%条" LayoutType="Table" NumericButtonTextFormatString="[{0}]" PageIndexBoxType="DropDownList" PageSize="15" ShowCustomInfoSection="Left" ShowPageIndexBox="Always" SubmitButtonText="Go" TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" UrlPaging="True" AlwaysShow="True">
                    </webdiyer:AspNetPager>
                </td>
            </tr>
        </table>
    </asp:Panel>
    </form>
</body>
</html>
